
package ass1;

import java.io.*;
import javax.swing.JOptionPane;

public class Main {
     public static void main(String[] args) {
        try {
            FileReader fro = new FileReader("D:\\seq.fasta");
            BufferedReader bro = new BufferedReader(fro); {
                String str1=bro.readLine();
                String str2 ="";
                while( str1!= null )       
                {
                    str2+= str1;
                    str1= bro.readLine( );  
                }
                String strin=str2.substring(9);
                System.out.println("Sequence:\n"+strin);
                float str=strin.length();
                System.out.println("String length:\n"+str);
                float Count = strin.replaceAll("[^a]","").length();
                System.out.println("A percentage:\n"+Count);
                String gene=strin.substring(7,74);
                System.out.println("gene:\n"+gene);
                String rna=strin.replace("t","u");
                System.out.println("RNA:\n"+rna);
                String st=strin.replace("a","b").replace("g","h").replace("t","a").replace("c","g").replace("h","c").replace("b","t");
                System.out.println("Compliment:\n"+st);
            }
        }
        
        catch( FileNotFoundException filenotfoundexp ){
             System.out.println( "myFile.txt, does not exist" );
        }
        catch(IOException ioexception){
        }
    }
}
